package com.ybb.production.service.impl;

import com.ybb.production.domain.GarmentProductionUpnumberRecord;
import com.ybb.production.mapper.GarmentProductionUpnumberRecordMapper;
import com.ybb.production.service.IGarmentProductionUpnumberRecordService;
import com.yubb.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 员工上数记录Service业务层处理
 *
 * @author dengjie
 * @date 2023-09-09
 */
@Service
public class GarmentProductionUpnumberRecordServiceImpl implements IGarmentProductionUpnumberRecordService {
    @Autowired
    private GarmentProductionUpnumberRecordMapper garmentProductionUpnumberRecordMapper;

    /**
     * 查询员工上数记录
     *
     * @param id 员工上数记录主键
     * @return 员工上数记录
     */
    @Override
    public GarmentProductionUpnumberRecord selectGarmentProductionUpnumberRecordById(Long id) {
        return garmentProductionUpnumberRecordMapper.selectGarmentProductionUpnumberRecordById(id);
    }

    /**
     * 查询员工上数记录列表
     *
     * @param garmentProductionUpnumberRecord 员工上数记录
     * @return 员工上数记录
     */
    @Override
    public List<GarmentProductionUpnumberRecord> selectGarmentProductionUpnumberRecordList(GarmentProductionUpnumberRecord garmentProductionUpnumberRecord) {
        return garmentProductionUpnumberRecordMapper.selectGarmentProductionUpnumberRecordList(garmentProductionUpnumberRecord);
    }

    /**
     * 新增员工上数记录
     *
     * @param garmentProductionUpnumberRecord 员工上数记录
     * @return 结果
     */
    @Override
    public int insertGarmentProductionUpnumberRecord(GarmentProductionUpnumberRecord garmentProductionUpnumberRecord) {
                garmentProductionUpnumberRecord.setCreateTime(DateUtils.getNowDate());
            return garmentProductionUpnumberRecordMapper.insertGarmentProductionUpnumberRecord(garmentProductionUpnumberRecord);
    }

    /**
     * 修改员工上数记录
     *
     * @param garmentProductionUpnumberRecord 员工上数记录
     * @return 结果
     */
    @Override
    public int updateGarmentProductionUpnumberRecord(GarmentProductionUpnumberRecord garmentProductionUpnumberRecord) {
                garmentProductionUpnumberRecord.setUpdateTime(DateUtils.getNowDate());
        return garmentProductionUpnumberRecordMapper.updateGarmentProductionUpnumberRecord(garmentProductionUpnumberRecord);
    }

    /**
     * 批量删除员工上数记录
     *
     * @param ids 需要删除的员工上数记录主键
     * @return 结果
     */
    @Override
    public int deleteGarmentProductionUpnumberRecordByIds(Long[] ids) {
        return garmentProductionUpnumberRecordMapper.deleteGarmentProductionUpnumberRecordByIds(ids);
    }

    /**
     * 删除员工上数记录信息
     *
     * @param id 员工上数记录主键
     * @return 结果
     */
    @Override
    public int deleteGarmentProductionUpnumberRecordById(Long id) {
        return garmentProductionUpnumberRecordMapper.deleteGarmentProductionUpnumberRecordById(id);
    }

    public List<GarmentProductionUpnumberRecord> selectGarmentProductionUpnumberRecordListByProcessIds(List<Long> lastProcessIds) {
        return garmentProductionUpnumberRecordMapper.selectGarmentProductionUpnumberRecordListByProcessIds(lastProcessIds);
    }

    public List<Map<String, Long>> getCompleteProcess(List<Long> cuttingIds) {
        return garmentProductionUpnumberRecordMapper.getCompleteProcess(cuttingIds);
    }
}
